<template>
  <div class="topiclist">
    <div class="title">
      热门专题
    </div>
    <div class="list">
      <router-link
        v-for="item in list"
        :key="item.id"
        tag="div"
        class="list-item"
        :to="'/topicDetail?id=' + item.id"
      >
        <img
          :src="item.cover_image"
          alt=""
        >
        <div class="info">
          <p class="name">
            {{ item.name }}
          </p>
          <p class="desc">
            {{ item.name }}
          </p>
        </div>
      </router-link>
    </div>
    <!-- <div class="more">点击加载更多</div> -->
  </div>
</template>

<script>
export default {
  name: "",
  components: {},
  data() {
    return {
      list: [],
      page: 1,
    };
  },
  mounted() {
    // this.getData();
  },
  methods: {
    getData(shopId) {
      let param = {
        page: this.page,
        limit: 4,
        shop_id: shopId,
      };
      if (this.page == 1) {
        this.list = [];
      }
      this.$api.home.topic(param).then((res) => {
        if (res.code == 1) {
          this.list = this.list.concat(res.data.data);
        }
      });
    },
    getMore() {
      this.page++;
      this.getData();
    },
  },
};
</script>

<style scoped lang="scss">
.topiclist {
  margin-top: 2.19rem;
  display: flex;
  flex-direction: column;

  .title {
    width: 11.25rem;
    height: 3.44rem;
    background: rgba(0, 0, 0, 1);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    font-family: Microsoft YaHei;
    font-weight: 400;
    color: rgba(234, 234, 234, 1);
  }
  .list {
    margin-top: 1.25rem;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    flex-wrap: wrap;
    .list-item {
      display: flex;
      flex-direction: column;
      height: 27rem;
      margin-right: 2rem;
      width: 42.5rem;
      background: #fff;
      margin-bottom: 1.31rem;
      cursor: pointer;
      &:nth-child(2n) {
        margin-right: 0;
      }
      img {
        width: 100%;
        height: 17rem;
        // object-fit: contain;
        display: block;
      }
      .info {
        display: flex;
        flex-direction: column;
        padding: 2.4rem 1.56rem;
        .name {
          font-size: 1.13rem;
          font-family: Microsoft YaHei;
          font-weight: 400;
          color: rgba(51, 51, 51, 1);
        }
        .desc {
          font-size: 0.88rem;
          font-family: Microsoft YaHei;
          font-weight: 400;
          color: rgba(119, 119, 119, 1);
          line-height: 1.7rem;
          margin-top: 1.38rem;
        }
      }
    }
  }
  .more {
    font-size: 1rem;
    font-family: Microsoft YaHei;
    font-weight: 400;
    color: rgba(102, 102, 102, 1);
    line-height: 1.95rem;
    text-align: center;
    margin: 3.13rem auto;
    cursor: pointer;
  }
}
</style>
